//统一管理咱们项目用户相关的接口
import request from '@/utils/request'
import { AxiosResponse } from 'axios'
import qs from 'qs'
import { OptionType } from '../user/type'
import { PermRes } from './type'

// 项目用户相关的请求地址
enum Perm_API {
  GET_PERM_LIST = '/teaching_system/perm/more',
  POST_OPEN_PERM = '/teaching_system/perm/change/{id}',
  PUT_CLOSE_PERM = '/teaching_system/perm/change/{id}',
}

/**
 * 获取权限列表
 * @returns
 */
export const reqGetPermList = () =>
  request.get<any, AxiosResponse<PermRes[]>>(Perm_API.GET_PERM_LIST)

/**
 * 开放权限
 * @returns
 */
export const reqOpenPerm = (id: number) =>
  request.post<any, AxiosResponse<any>>(
    Perm_API.POST_OPEN_PERM.replace('{id}', id.toString()),
  )

/**
 * 关闭权限
 * @returns
 */
export const reqClosePerm = (id: number) =>
  request.put<any, AxiosResponse<any>>(
    Perm_API.PUT_CLOSE_PERM.replace('{id}', id.toString()),
  )
